<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'standInfo.jsp' starting page</title>
    
	<link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
	integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
	crossorigin="anonymous">
	<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>

  </head>
  
  <body>
    <h1 style="text-align: center">标准信息列表</h1>
    <form action="" method="get" style="text-align: right">
    	<p>
    		<input type="text" name="likeName" id="likeName" value="${likeName }" style="text-align: left">
    		<input type="submit" id="geted" value="提交搜索">
    		<input type="button" id="add" value="新增标准">
    		<input type="button" id="del" value="删除标准">
    		<input type="hidden" id="pageNo" name="pageNo" value="${page.pageNo }">
			<input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize }">
			<input type="hidden" id="pageCount" name="pageCount" value="${page.pageCount }">
			<input type="hidden" id="totalCount" name="totalCount" value="${page.totalCount }">
    	</p>
   		<div>
    		<table class="table" style="width:100%;text-align: center">
    			<tr style="background-color: #ccc">
	    			<th style="text-align: center"><input type="checkbox"></th>
					<th style="text-align: center">标准号</th>
					<th style="text-align: center">中文名称</th>
					<th style="text-align: center">版本</th>
					<th style="text-align: center">发布日期</th>
					<th style="text-align: center">实施日期</th>
					<th style="text-align: center">操作</th>
				</tr>
			<c:choose>
    			<c:when test="${!empty std}">
					<c:forEach items="${std}" var="std" varStatus="status">
						<tr>
							<td><input type="checkbox" name="id" value="${std.id }"></td>
							<td>${std.stdNum}</td>
							<td>${std.zhname}</td>
							<td>${std.version}</td>
							<td>
								<fmt:formatDate value="${std.releaseDate}" pattern="yyyy-MM-dd"/>
							</td>
							<td>
								<fmt:formatDate value="${std.implDate}" pattern="yyyy-MM-dd"/>
							</td>
							<td>
								<a href="">下载</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<a href="update1.html?id=${std.id}&likeName=${likeName}&pageNo=${page.pageNo}&pageSize=${page.pageSize}">修改</a>
							</td>
						</tr>
					</c:forEach>
    				</c:when>
    			</c:choose>
    		</table>
   		 </div>
   		 <c:import url="page.jsp">
				<c:param name="pageNo" value="${page.pageNo }"></c:param>
				<c:param name="pageCount" value="${page.pageCount }"></c:param>
				<c:param name="pageSize" value="${page.pageSize }"></c:param>
				<c:param name="totalCount" value="${page.totalCount }"></c:param>
		</c:import>
     </form>
     <script type="text/javascript">
     	$("#del").click(function(){
			 	$("form").attr("action","deleteInfo.html");
			 	$("form").submit();
			});
		$("#add").click(function(){
			 	$("form").attr("action","add.html");
			 	$("form").submit();
			});
		$("#geted").click(function(){
				$("form").attr("action","std.html");
				$("form").submit();
		})
     	
		document.getElementsByTagName("select")[0].onchange = function() {
			var likeName = document.getElementById("likeName").value;
			var pageSize = this.value;
			location.href = "std.html?pageNo=1&pageSize=" + pageSize +"&likeName=" +likeName;
		}
	</script>
  </body>
</html>
